package com.jkj.http.controller;


import com.jkj.utils.ueditor.ActionEnter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.commons.CommonsMultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;

@RestController
@RequestMapping("/ueditor")
public class UeditorController {

    @Value("${filePath}")
    private String filePath;


    @RequestMapping(value = "/controller", produces = "application/json; charset=utf-8")
    public void config(HttpServletRequest request, HttpServletResponse response) {
        try {
            String result = new ActionEnter(request,filePath).exec();
            PrintWriter writer = response.getWriter();
            writer.write(result);
            writer.flush();
            writer.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


}
